package com.hnzq.cloud.api;

import com.hnzq.cloud.dto.FreGoodsDto;
import com.hnzq.cloud.model.Result;
import com.hnzq.cloud.param.AddFreGoodsInfoParam;
import com.hnzq.cloud.param.UpdateFreGoodsInfoParam;
import com.hnzq.cloud.param.UpdateStockParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "goods-assembly",contextId = "GoodsAPI")
public interface FreGoodsAPI {

    @PostMapping("addFreGoods")
    Result addFreGoods(@RequestBody AddFreGoodsInfoParam addFreGoodsInfoParam);

    @PutMapping("putOnFreGoods")
    Result putOnFreGoods(@RequestParam("id") Integer freGoodsId);

    @PutMapping("offFreGoods")
    Result offFreGoods(@RequestParam("id") Integer freGoodsId);

    @PutMapping("changeFreGoodsInfo")
    Result changeFreGoodsInfo(@RequestBody UpdateFreGoodsInfoParam updateFreGoodsInfoParam);

    @DeleteMapping("deleteFreGoods")
    Result deleteFreGoods(@RequestParam("ids") List<Integer> ids);

    @PutMapping("updateFreGoodsStock")
    Result updateFreGoodsStock(@RequestBody List<UpdateStockParam> updateStockParams);

    @GetMapping("findAllGoods")
    Result findAllGoods();

    @GetMapping("getGoodsByType")
    Result getGoodsByType(@RequestParam("typeId") Integer typeId);

    @GetMapping("getGoodsByFlag")
    Result getGoodsByFlag(@RequestParam("flagId") Integer flagId);

    @GetMapping("selectGoodsByKeyword")
    Result selectGoodsByKeyword(@RequestParam("keyword") String keyword);

    @GetMapping("findFreGoodsInfo")
    Result<FreGoodsDto> findFreGoodsInfo(@RequestParam("id") Integer id);

    @GetMapping("findGoodsInfos")
    Result<Map<Integer, FreGoodsDto>> findGoodsInfos(@RequestParam("ids") List<Integer> ids);
}
